home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-06-19 | 2.6 KB | 97 lines |
- /*
- * DefaultData.java 1.0 12 Jan 1997
- *
- * Copyright (c) 1996 Krumel & Associates, Inc. All Rights Reserved.
- *
- * This software is provided as is. Krumel & Associates shall not be liable
- * for any damages suffered by licensee as a result of using, modifying or
- * distributing this software or its derivatives.
- */
-
- package symantec.itools.db.awt;
-
- //This class is designed to work with the DefaultDataSource, but with care should be
- //usable by other DataSource classes.
- //
- //CAUTION - CAUTION - CAUTION
- //A TableCell should never hold onto this object (or any other Data object) for more
- //than one invocation because a DataSource will usually reuse this object.
- public class DefaultData implements Data {
- int row;
- int col;
- DataSource dataSource;
-
- public DefaultData(DataSource ds) {
- dataSource = ds;
- }
-
- public void setRowAndCol(int r, int c) {
- row = r;
- col = c;
- }
-
- public int type() {
- return dataSource.type(row, col);
- }
-
- public boolean isEditable(int row, int col) {
- return dataSource.isDataEditable(row, col);
- }
-
- public boolean changed() { return false; }
-
- public void rollback() {}
-
- public void commit() {}
-
- public boolean supportsChoice() {
- return dataSource.supportsChoice(row, col);
- }
-
- public Data[] getChoices() throws TypeNotSupported {
- return dataSource.getChoices(row, col);
- }
-
- public void setText(String t) {
- dataSource.setText(row, col, t);
- }
-
- //pos is space where to be inserted (0 = first char)
- public void insertChar(int pos, char c) {
- //this will most likely throw a STringIndexOUtOfBoundsException
- dataSource.insertChar(row, col, pos, c);
- }
-
- public void setText(char c) {
- setText(String.valueOf(c));
- }
-
- public void appendChar(char c) {
- dataSource.appendChar(row, col, c);
- }
-
- public void clearText() {
- dataSource.clearText(row, col);
- }
-
- public void deleteChar(int pos) {
- //this will most likely throw a STringIndexOUtOfBoundsException
- dataSource.deleteChar(row, col, pos);
- }
-
- public String subString(int spos, int epos) {
- return dataSource.subString(row, col, spos, epos);
- }
-
- public void setImage(java.awt.Image i) {
- dataSource.setImage(row, col, i);
- }
-
- public String toString() {
- return dataSource.toString(row, col);
- }
-
- public java.awt.Image toImage() {
- return dataSource.toImage(row, col);
- }
- }